package com.equinox.nacos.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

/**
 *public class ProviderController{ }
 * @author ASDFGH
 * @date 2021年1月6日 下午3:53:57
 */
@RestController
public class ProviderController {
	@Value("${server.port}")
	private String port;
	@Autowired
	private ConfigurableApplicationContext context;

	@GetMapping(value = "/test/{message}")
	public String test(@PathVariable String message) {
		return "Hello Nacos Discovery " + message + " i am from port " + port;
	}

	@GetMapping(value = "/hi")
	public String sayHi() {
		return "Hi " + context.getEnvironment().getProperty("user.name");
	}
}
